<template>
	<view class="page_box">
		<u-navbar :is-back="true" title="填写资料" v-if="1" :border-bottom="fasle"></u-navbar>

		<view class="content_box padding">
			<scroll-view scroll-y="true" style="height: 80vh;">
				<view class="padding-top padding-bottom-sm flex flex-direction solid-bottom">
					<text class="f28 text-bold text">姓名</text>
					<input type="text" value="" v-model="real_name" class="margin-top" placeholder="请输入姓名" placeholder-class="ddd" />
				</view>
				<view class="padding-top padding-bottom-sm flex flex-direction solid-bottom">
					<text class="f28 text-bold text">性别</text>
					<view class="margin-top flex">
						<view class="flex" @click="gender(1)">
							<image
								src="../../static/dui22.png"
								mode="aspectFill"
								class="w30 h30 animation-scale-up"
								v-if="c == 1"
							></image>
							<image src="../../static/dui222.png" mode="aspectFill" class="w30 h30 " v-else></image>
							<text class="ml13">男</text>
						</view>
						<view class="flex ml60" @click="gender(2)">
							<image src="../../static/dui222.png" mode="aspectFill" class="w30 h30 " v-if="c == 1"></image>
							<image
								src="../../static/dui22.png"
								mode="aspectFill"
								class="w30 h30 animation-scale-up"
								v-else
							></image>
							<text class="ml13">女</text>
						</view>
					</view>
				</view>
				<view class="padding-top padding-bottom-sm flex flex-direction solid-bottom">
					<text class="f28 text-bold text">联系电话</text>
					<input type="text" value="" v-model="phone" class="margin-top" placeholder="请输入联系电话" placeholder-class="ddd" />
				</view>
				<view class="padding-top padding-bottom-sm flex flex-direction solid-bottom">
					<text class="f28 text-bold text">公司名称</text>
					<input type="text" value="" v-model="company_name" class="margin-top" placeholder="请输入公司名称" placeholder-class="ddd" />
				</view>
				<view class="padding-top padding-bottom-sm flex flex-direction solid-bottom">
					<text class="f28 text-bold text">所属行业</text>
					<input type="text" value="" v-model="industry_type" class="margin-top" placeholder="请输入所属行业" placeholder-class="ddd" />
				</view>
				<view class="padding-top padding-bottom-sm flex flex-direction solid-bottom">
					<text class="f28 text-bold text">职位</text>
					<input type="text" value="" v-model="job_name" class="margin-top" placeholder="请输入职位" placeholder-class="ddd" />
				</view>
				<view class="padding-top padding-bottom-sm flex flex-direction ">
					<text class="f28 text-bold text">企业/产品介绍</text>
					<view class="padding margin-top" style="background: #F7F7F7;">
						<textarea value="" v-model="product_description" placeholder="请输入产品介绍" placeholder-class="fff" />
					</view>
				</view>
				<view class="padding-top padding-bottom-sm flex flex-direction ">
					<text class="f28 text-bold text">主营业务</text>
					<view class="padding margin-top" style="background: #F7F7F7;">
						<textarea value="" v-model="main_business" placeholder="请输入主营业务" placeholder-class="fff" />
					</view>
				</view>
				<view class="h120"></view>
			</scroll-view>
			<button class="cu-btn btn flex align-center justify-center" @click.stop="dataModification">
				<text>提交</text>
			</button>
		</view>
		<!-- <u-tabbar v-model="current" :list="tabbarList" :border-top="false" active-color="#F2736D" @change="change"></u-tabbar> -->
		<yy-login v-if="vuex_login"></yy-login>
		<yy-loading text="加载中.." mask="true" click="true" ref="loading"></yy-loading>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
export default {
	data() {
		return {
			c: 1,
			phone: '',
			company_name: '',  
			industry_type: '',  
			job_name: '',  
			product_description: '',
			main_business: '',
			real_name: '', 
			sex: 1//1 男，2 女
		};
	},
	onShow() {},

	onLoad(e) {},
	methods: {
		async gender(e) {
			this.c = e;
			this.sex = e
		},

		//资料修改
		async dataModification() {
			console.log('this.sex :>> ', this.sex);
			if (
				[
					this.phone,
					this.company_name,
					this.industry_type,
					this.job_name,
					this.product_description,
					this.main_business,
					this.real_name,
					this.sex
				].includes('')
			) {
				return this.$refs.uToast.show({ title: '请填写完整后提交',type: 'error' });
			}
			let obj = {
				phone: this.phone,
				company_name: this.company_name,
				industry_type: this.industry_type,
				job_name: this.job_name,
				product_description: this.product_description,
				main_business: this.main_business,
				real_name: this.real_name,
				sex: this.sex
			};
			const res = await this.$u.post('UserInfo/userExtends', obj, {});
			if (res.code) {
				this.$refs.uToast.show({ title: '填写成功',type: 'success' });
				let pages = getCurrentPages();  //获取所有页面栈实例列表
				let nowPage = pages[ pages.length - 1];  //当前页页面实例
				let prevPage = pages[ pages.length - 2 ];  //上一页页面实例
				prevPage.$vm.participate = true;   //修改上一页data里面的sh参数值为100
				uni.navigateBack({  //uni.navigateTo跳转的返回，默认1为返回上一级
				    delta: 1
				});
			}
			console.log('res >>  ', res);
		}
	}
};
</script>

<style lang="scss" scoped>
.page_box {
	/deep/input,
	.ddd {
		color: #333333;
		font-family: PingFang SC;
	}
	.text {
		display: flex;
	}
	.fff {
		color: #333333;
		font-family: PingFang SC;
	}
	.text::after {
		content: '*';
		color: #f2736d;
		margin-left: 5rpx;
	}
	.btn {
		position: fixed;
		bottom: calc(env(safe-area-inset-bottom) / 2);
		left: 50%;
		transform: translateX(-50%);
		width: 690rpx;
		height: 100rpx;
		background: #f2736d;
		border-radius: 50rpx;

		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #ffffff;
		z-index: 999;
	}
}
</style>
